/*
 * Copyright (c) 2023-2025 elsfs Authors. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.elsfs.cloud.common.mybatis.ext.sql;

import java.util.Collection;
import org.elsfs.cloud.common.core.entity.BaseEntity;

/**
 * 删除SQL
 *
 * @param <C> 子类具体类型
 * @param <B> 删除条件构建器类型
 */
public interface DeleteSql<
        C extends DeleteSql<C, B>, B extends DeleteSql.DeleteConditionBuilder<B, C>>
    extends SqlFragment {

  /**
   * 删除数据的表别名
   *
   * @param tableAlias 表别名
   * @return 具体实现
   */
  C delete(String tableAlias);

  /**
   * 删除数据的表别名
   *
   * @param tableAliases 表别名
   * @return 具体实现
   */
  C delete(String... tableAliases);

  /**
   * 删除数据的表别名
   *
   * @param tableAliases 表别名
   * @return 具体实现
   */
  C delete(Collection<String> tableAliases);

  /**
   * 设置删除数据的表
   *
   * @param entityClass 实体类
   * @return 具体实现
   */
  C from(Class<? extends BaseEntity> entityClass);

  /**
   * 设置删除数据的表
   *
   * @param table 表名
   * @return 具体实现
   */
  C from(String table);

  /**
   * 设置删除数据的表
   *
   * @param entityClass 实体类
   * @param tableAlias 表别名
   * @return 具体实现
   */
  C from(Class<? extends BaseEntity> entityClass, String tableAlias);

  /**
   * 设置删除数据的表
   *
   * @param table 表名
   * @param tableAlias 表别名
   * @return 具体实现
   */
  C from(String table, String tableAlias);

  /**
   * 设置删除条件
   *
   * @return 条件构建器
   */
  DeleteConditionBuilder<B, C> where();

  /**
   * 删除条件构建器
   *
   * @param <C> 具体实现
   * @param <P> 上级对象类型
   */
  interface DeleteConditionBuilder<
          C extends DeleteConditionBuilder<C, P>, P extends DeleteSql<P, C>>
      extends SortableCondition<C>, Completable<P> {}
}
